<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>getElementById方法演示文档</title>
  </head>
  <body>
    <div>
      <p id="first"></p>
    </div>
  </body>
  <script>
    var myName = prompt("请输入您的名字:");
    var firstElement = document.getElementById("first");
    firstElement.innerHTML = myName;
    firstElement.style.color = "blue";
  </script>
</html>
